﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;

namespace CS795.TravelAgency.Domain.Entities.Configurations
{
    public class HotelReservationConfiguration : EntityTypeConfiguration<HotelReservation>
    {
        public HotelReservationConfiguration()
        {
            HasKey(p => p.Id);
            HasRequired(p => p.Trip).WithMany().HasForeignKey(p => p.TripId).WillCascadeOnDelete(true);
            HasRequired(p => p.Vendor).WithMany().HasForeignKey(p => p.VendorId).WillCascadeOnDelete(true);
            Property(p => p.Status).IsRequired();
            Property(p => p.QuoteId).IsRequired();
            Property(p => p.PricePerNight).HasPrecision(18, 2).IsRequired();
            Property(p => p.TotalPrice).HasPrecision(18, 2).IsRequired();
            Property(p => p.ReservationId).IsOptional();
            Property(p => p.RoomType).IsRequired();
            Property(p => p.Smoking).IsRequired();
            Property(p => p.CheckIn).IsRequired();
            Property(p => p.CheckOut).IsRequired();
        }
    }
}
